﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>ImagesUpload</title>
    <link href="~/layui/css/layui.css" rel="stylesheet" />
    <link href="~/layuimini/css/public.css" rel="stylesheet" />
    <link href="~/layuimini/lib/jq-module/zyupload/zyupload-1.0.0.min.css" rel="stylesheet" />
    <style>
        .layui-btn-container {
            font-size: 15px;
        }
    </style>
</head>
<body>
    <div class="layuimini-container">
        <div class="layui-btn-container">
            <button type="button" class="layui-btn layui-btn-normal" id="test8">选择文件</button>
            <button type="button" class="layui-btn" id="test9">开始上传</button>
            <a href="~/DownLoads/产品导入模版.xlsx">产品导入模版下载</a>
        </div>
        <div>
            注：第三、四列为数字1到7，多个用半角逗号分割，如 1,2,3<br/>
            1到7分别代表<br/>
            1	一车间前道工序<br />
            2	一车间后道工序<br />
            3	二车间<br />
            4	三车间<br />
            5	电源事业部<br />
            6	集成电路封装<br />
            7	集成电路筛选
        </div>
    </div>
    <script src="~/layuimini/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="~/layui/layui.js"></script>
    <script type="text/javascript">
            layui.use(['upload', 'element', 'layer','form'], function () {
                var $ = layui.jquery
                , upload = layui.upload
                , element = layui.element
                , form=layui.form
                , layer = layui.layer;

                var uploadInst=upload.render({
                    elem: '#test8'
                 , url: "/BasicInfo/GoodsUploadFile" //改成您自己的上传接口
                 , auto: false
                 , accept: 'file'
                 , acceptMime: 'application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
                 , exts: 'xls|xlsx'// 上传文件的类型
                 , fileSize: 1024000    // 上传文件的大小
                 , data: { TypeID: '@ViewBag.TypeID'}
                    //,multiple: true
                 , bindAction: '#test9'
                 , done: function (res) {
                     if (res.Code == 0) {
                         layer.msg('成功', { icon: 6, time: 2000 },
                                           function () {
                                               var index = parent.layer.getFrameIndex(window.name);
                                               parent.layer.close(index);
                                           });
                     }
                     else {
                         layer.alert(res.Message, { icon: 5 });
                     }

                     console.log(res)
                 }
                });
                // 初始化插件
                //选完文件后不自动上传
                form.on('select(brickType)', function (data) {
                    uploadInst.reload({
                        data: { OrderBillID: $('#OrderBillID').val() },
                    });
                });

            });
    </script>
</body>
</html>
